package com.xing.game.server;

import com.xing.game.bean.DefaultBeanFactory;
import java.util.concurrent.ExecutionException;

public class BeanContext {

    private final DefaultBeanFactory factory;

    private static DefaultBeanFactory INSTANCE;

    public BeanContext(DefaultBeanFactory factory) {

        this.factory = factory;

        INSTANCE = this.factory;
    }

    public static ExcutorWorkers getWorkers() {
        try {
            return INSTANCE.getBean(ExcutorWorkers.class);
        } catch (ExecutionException e) {
            return null;
        }
    }

    public static Object getBean(Class<?> clazz) {
        try {
            return INSTANCE.getBean(clazz);
        } catch (ExecutionException e) {
            return null;
        }
    }


}
